package cn.com.spic.demo.controller;

import cn.com.spic.demo.api.BenchMarService;
import cn.com.spic.demo.dto.BenchMarkDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ProjectName: demo-contract-consumer
 * @Package: cn.com.spic.demo.controller
 * @ClassName: BenchMarkController
 * @Date: 2021/1/29 14:17
 * @Author:
 */
@RestController
@RequestMapping(value = "/bench")
public class BenchMarkController {

    @Autowired
    private BenchMarService benchMarService;

    @GetMapping("/getBenchMark")
    public List<BenchMarkDTO> setBenchMarService(HttpServletRequest request) {
        String pageIndex = request.getParameter("pageIndex");
        String pageSize = request.getParameter("pageSize");
        Map<String,Integer > map = new HashMap<>();

        map.put("beginNumber",Integer.parseInt(pageIndex)*Integer.parseInt(pageSize));
        map.put("endNumber",Integer.parseInt(pageSize));
        return benchMarService.getBenchMark(map);
    }
}
